/**
 * list implementation for CS3251 Project 2.
 *
 *
 * Created and edited by: Nicolas Papin
 **/

#ifndef _LIST_H_DEF_
#define _LIST_H_DEF_

#include "gpsTrac.h"

/**
 * Data Types and Definitions
 **/

/*
* Normally I would try to make a more general implementation but this does not really seem necessary in this case.
*/
typedef struct userNode
{
    int socketNum;
    char uname[USER_ID_LEN];
    gpsCoord_t lastPos;
    pthread_t thread;
    struct userNode *next;
} userNode_t;

/*
 * Type for the actual list.
 * Normally I would make this a generic list, but I only need it for PCBs for this implementation.
 */
typedef struct {
    userNode_t *head;
    userNode_t *tail;
    unsigned int size;
} userList_t;



/**
 * Prototypes
 **/

/* Creating */
userList_t *create_list();

/* Adding */
void addNode(userList_t *list, userNode_t *node);

/* Removing */
userNode_t *removeNode(userList_t *list, userNode_t *node);

/* Searching */
userNode_t *findWithName(userList_t *list, const char *name);


#endif
